package com.xq.springboot.util;

import com.xq.springboot.domain.ResponseResult;

/**
 * 响应结果工具类.
 * 
 * @author 郭凯强
 */
public class HttpResultUtil {
	private static final String SUCCESS = "成功";

	public static ResponseResult success(Object result) {
		ResponseResult httpResult = new ResponseResult();
		httpResult.setErrorCode(0);
		httpResult.setMessage(SUCCESS);
		httpResult.setResult(result);
		return httpResult;
	}

	public static ResponseResult success() {
		return success(null);
	}

	public static ResponseResult error(Integer code, String msg) {
		ResponseResult httpResult = new ResponseResult();
		httpResult.setErrorCode(code);
		httpResult.setMessage(msg);
		return httpResult;
	}
}
